package com.yiren.manager.service.impl.pension;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yiren.core.exception.MyException;
import com.yiren.core.service.GenericServiceImpl;
import com.yiren.core.utils.Favorites;
import com.yiren.entity.YrBedCost;
import com.yiren.entity.YrBedCostHistory;
import com.yiren.manager.repository.pension.YrBedCostHistoryRepository;
import com.yiren.manager.repository.pension.YrBedCostRepository;
import com.yiren.manager.service.iface.pension.YrBedCostService;

@Service("yrBedCostService")
public class YrBedCostServiceImpl extends GenericServiceImpl<YrBedCost, String> implements YrBedCostService{

	@Autowired
	private YrBedCostHistoryRepository yrBedCostHistoryRepository;
	
	@Autowired
	public YrBedCostServiceImpl(YrBedCostRepository repository) {
		super(repository);
	}

	@Transactional
	public void addByFavorites(Favorites entitys) throws MyException {
		YrBedCost yrBedCost = entitys.getFavorite(YrBedCost.class);
		YrBedCostHistory yrBedCostHistory = entitys.getFavorite(YrBedCostHistory.class);
	
		this.repository.save(yrBedCost);
		yrBedCostHistoryRepository.save(yrBedCostHistory);
	}

	public void modifyByFavorites(Favorites entitys) throws MyException {
		// TODO Auto-generated method stub
		
	}

}
